Creates an IIndexedSource<(Of <(<'T>)>)> based on the specified IObservableSource<(Of <(<'T>)>)> collection.

Namespace:  C1.LiveLinq
Assembly:  C1.LiveLinq (in C1.LiveLinq.dll)

Syntax

C#
public static IIndexedSource<T> ToIndexed<T>(
	this IObservableSource<T> source
)
Visual Basic
<ExtensionAttribute> _
Public Shared Function ToIndexed(Of T) ( _
	source As IObservableSource(Of T) _
) As IIndexedSource(Of T)

Parameters

source
Type: C1.LiveLinq..::..IObservableSource<(Of <(<'T>)>)>
An IObservableSource<(Of <(<'T>)>)> collection to base an IIndexedSource<(Of <(<'T>)>)> on.

Type Parameters

T
The type of the elements in the collection.

Return Value

An IIndexedSource<(Of <(<'T>)>)> that contains the same elements as the IObservableSource<(Of <(<'T>)>)> collection and enables indexing of that collection.

Remarks

Use this method to index and query your collection if that collection is your own custom implementation of the IObservableSource<(Of <(<'T>)>)> interface.

Elements of the source collection aren't duplicated or copied to a new collection. This method just wraps the original collection in an IIndexedSource<(Of <(<'T>)>)>, enabling its indexing by using the change notification mechanism of IObservableSource<(Of <(<'T>)>)>.

Note: Indexes created on the resulting IIndexedSource<(Of <(<'T>)>)> are owned by it and not by the original collection. Every ToIndexed() call creates a separate object that has its own separate indexes. Avoid calling ToIndexed() repeatedly for the same collection because it can increase the cost of maintaining indexes.

See Also